Skip to content

Conversation

@ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Dec 17, 2025

r? @Kobzol

Since it looks like we'll postpone enabling offload in CI for a bit, I factored out these improvements which we want independently. I locally tested both build options successfully, the in-tree-clang build, as well as the build where we provide a path to an external clang.

@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2025

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2025

Kobzol is not on the review rotation at the moment.
They may take a while to respond.

@ZuseZ4 ZuseZ4 force-pushed the offload-build-rework branch from 93bc6ea to 4b2d2b9 Compare December 17, 2025 18:32
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the offload-build-rework branch from 4b2d2b9 to dbe2964 Compare December 17, 2025 21:08
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, otherwise it looks reasonable.

View changes since this review

}

impl Step for OmpOffload {
type Output = PathBuf;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please modify this to be more similar to #150071? So that it returns some named struct that contains the final path to the libXXX dylibs. So that code that then uses the output (e.g. in the Assemble step) does not need to guess how are the files named, and the corresponding logic to find the files is localized within this step.

// binaries. We therefore write our offload artifacts into it's own subfolder. We use a
// subfolder, so that all the logic that processes our build artifacts (hopefully) also
// automatically manages our artifacts in the subfolder.
let out_dir = builder.llvm_out(target).join("offload-outdir");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think that we should use a different build directory, and handle the copying manually in the Assemble step. We should not rely on other code copying the offload stuff for us. Partly also because we will want to have it as a separate component, and not put the offload things into e.g. the rustc or llvm-tools component by accident.

builder.sysroot_target_libdir(target_compiler, target_compiler.host);
let lib_ext = std::env::consts::DLL_EXTENSION;

let libenzyme = "libLLVMOffload";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in another comment, the logic for locating these components should ideally be localized within the offload step itself. It should then contain the paths to the dylibs (either just as a Vec<PathBuf>, or as three fields, depending on whether it is useful to distinguish them), and the code here in Assembly should just copy them to the correct directories.

@Kobzol Kobzol mentioned this pull request Dec 19, 2025
@Kobzol
Copy link
Member

Kobzol commented Dec 19, 2025

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 19, 2025
@ZuseZ4 ZuseZ4 mentioned this pull request Dec 19, 2025
5 tasks
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    = note: `-D unused-mut` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_mut)]`

error: could not compile `bootstrap` (lib) due to 1 previous error
failed to run: /checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo build --jobs=default --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked --features build-metrics
Build completed unsuccessfully in 0:00:19
make: *** [Makefile:99: prepare] Error 1
Command failed. Attempt 2/5:
##[group]Building bootstrap
   Compiling bootstrap v0.0.0 (/checkout/src/bootstrap)
---
    = note: `-D unused-mut` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_mut)]`

error: could not compile `bootstrap` (lib) due to 1 previous error
failed to run: /checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo build --jobs=default --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked --features build-metrics
Build completed unsuccessfully in 0:00:03
make: *** [Makefile:99: prepare] Error 1
Command failed. Attempt 3/5:
##[group]Building bootstrap
   Compiling bootstrap v0.0.0 (/checkout/src/bootstrap)
---
    = note: `-D unused-mut` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_mut)]`

error: could not compile `bootstrap` (lib) due to 1 previous error
failed to run: /checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo build --jobs=default --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked --features build-metrics
Build completed unsuccessfully in 0:00:03
make: *** [Makefile:99: prepare] Error 1
Command failed. Attempt 4/5:
##[group]Building bootstrap
   Compiling bootstrap v0.0.0 (/checkout/src/bootstrap)
---
    = note: `-D unused-mut` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_mut)]`

error: could not compile `bootstrap` (lib) due to 1 previous error
failed to run: /checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo build --jobs=default --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked --features build-metrics
Build completed unsuccessfully in 0:00:03
make: *** [Makefile:99: prepare] Error 1
Command failed. Attempt 5/5:
##[group]Building bootstrap
   Compiling bootstrap v0.0.0 (/checkout/src/bootstrap)
---
    = note: `-D unused-mut` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_mut)]`

error: could not compile `bootstrap` (lib) due to 1 previous error
failed to run: /checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo build --jobs=default --manifest-path /checkout/src/bootstrap/Cargo.toml -Zroot-dir=/checkout --locked --features build-metrics
Build completed unsuccessfully in 0:00:03
make: *** [Makefile:99: prepare] Error 1
The command has failed after 5 attempts.
  local time: Sun Dec 21 10:37:12 UTC 2025
  network time: Sun, 21 Dec 2025 10:37:12 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants